package com.ding.dailyup.model;

import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * 用户表
 */
@Entity
@DynamicInsert
@Table(name = "user_info")
@EntityListeners(AuditingEntityListener.class)
public class UserInfo implements Serializable {
    public static final long serialVersionUID = 4994387673871867019L;
    private Long id;
    private String username;
    private String password;
    private Integer gender;
    private LocalDateTime birthday;
    private Long points;
    private LocalDateTime lastLoginTime;
    private String lastLoginIp;
    private Integer userLevel;
    private String nickname;
    private String mobile;
    private String avatar;
    private String weixinOpenid;
    private String sessionKey;
    private Integer status;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    private Integer deleted;


    public UserInfo() {
    }

    public UserInfo(
            String username, String password, Integer gender, LocalDateTime birthday, Long points, LocalDateTime lastLoginTime, String lastLoginIp, Integer userLevel, String nickname, String mobile, String avatar, String weixinOpenid, String sessionKey, Integer status, LocalDateTime createTime, LocalDateTime updateTime, Integer deleted) {
        this.username = username;
        this.password = password;
        this.gender = gender;
        this.birthday = birthday;
        this.points = points;
        this.lastLoginTime = lastLoginTime;
        this.lastLoginIp = lastLoginIp;
        this.userLevel = userLevel;
        this.nickname = nickname;
        this.mobile = mobile;
        this.avatar = avatar;
        this.weixinOpenid = weixinOpenid;
        this.sessionKey = sessionKey;
        this.status = status;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.deleted = deleted;
    }


    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    /**
     * @return 用户名称
     */
    @Column(name = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }


    /**
     * @return 用户密码 default : ''
     */
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    /**
     * @return 性别：0 未知， 1男， 1 女 default : 0
     */
    @Column(name = "gender")
    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }


    /**
     * @return 生日
     */
    @Column(name = "birthday")
    public LocalDateTime getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDateTime birthday) {
        this.birthday = birthday;
    }


    /**
     * @return 用户积分 default : 0
     */
    @Column(name = "points")
    public Long getPoints() {
        return points;
    }

    public void setPoints(Long points) {
        this.points = points;
    }


    /**
     * @return 最近一次登录时间
     */
    @Column(name = "last_login_time")
    public LocalDateTime getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(LocalDateTime lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }


    /**
     * @return 最近一次登录IP地址 default : ''
     */
    @Column(name = "last_login_ip")
    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }


    /**
     * @return 0 普通用户，1 VIP用户，2 高级VIP用户 default : 0
     */
    @Column(name = "user_level")
    public Integer getUserLevel() {
        return userLevel;
    }

    public void setUserLevel(Integer userLevel) {
        this.userLevel = userLevel;
    }


    /**
     * @return 用户昵称或网络名称 default : ''
     */
    @Column(name = "nickname")
    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }


    /**
     * @return 用户手机号码 default : ''
     */
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    /**
     * @return 用户头像图片 default : ''
     */
    @Column(name = "avatar")
    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }


    /**
     * @return 微信登录openid default : ''
     */
    @Column(name = "weixin_openid")
    public String getWeixinOpenid() {
        return weixinOpenid;
    }

    public void setWeixinOpenid(String weixinOpenid) {
        this.weixinOpenid = weixinOpenid;
    }


    /**
     * @return 微信登录会话KEY default : ''
     */
    @Column(name = "session_key")
    public String getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }


    /**
     * @return 0 可用, 1 禁用, 2 注销 default : 0
     */
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }


    /**
     * @return 创建时间
     */
    @Column(name = "create_time", updatable = false)
    @CreatedDate
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }


    /**
     * @return 更新时间
     */
    @Column(name = "update_time")
    @LastModifiedDate
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }


    /**
     * @return 逻辑删除 default : 0
     */
    @Column(name = "deleted")
    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

}